package com.rem.bootnacos.controller;

import com.rem.bootnacos.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author Rem
 * @date 2021/7/5
 */
@RestController
@RequestMapping("/config")
//@RefreshScope
public class ConfigController {

    @Autowired
    private Person person;

    @Value("${user.name}")
    private String name;

    @Value("${user.age}")
    private Integer age;

    @GetMapping("/getPerson")
    public Person getPerson() {
        return person;
    }

    @GetMapping("/getUserName")
    public String getUserName() {
        return name;
    }

    @GetMapping("/getUserAge")
    public Integer getUserAge() {
        return age;
    }

}